package exception_exercise;

import java.io.FileOutputStream;
import java.io.IOException;

public class FinallyDemo22 {
    public static void main(String[] args) {
        System.out.println("程序开始");
        FileOutputStream fos2=null;
        try{
            fos2=new FileOutputStream("fos2.dat");
            fos2.write(2);
        }catch (IOException e2){
            System.out.println("出现问题并解决了");
        }finally {
            try {
                fos2.close();
            } catch (IOException e2) {
                System.out.println("关闭流时出现异常并解决了");
            }
        }
        System.out.println("程序结束");
    }
}
